// 导航栏
import { findHeadCategory } from '@/api/home'
const category = {
  namespaced: true,
  // 存数据
  state: () => ({
    list: []
  }),
  // 唯一能改变state的数据
  mutations: {
    setCategory (state, categoryList) {
      state.list = categoryList
    }
  },
  // 异步 + mutation
  actions: {
    async asyncSetList (ctx) {
      const res = await findHeadCategory()
      // console.log(res)
      ctx.commit('setCategory', res.result)
    }
  }

}

export default category
